import React from 'react';

import {

} from 'react-native';

import Constants from '../../common/Constants';
import CommonRequestDataAction from '../common/CommonRequestDataAction';

export default class CommonRequestADAction extends CommonRequestDataAction {
  constructor() {
    super();
    this.moduleType = Constants.MODULE_TYPE.COMMON;
    this.name = "CommonRequestADAction";
  }

  finish(data, isSucceed, response) {
      if(isSucceed) {
        let dic ={viewStatus: 3,isResponeUpdate: true,}
        if (this.data.dataKeyq!==undefined) {
          dic[this.data.dataKeyq]=data
        }else{
          dic['data']=data
        }
         dic['data']=data
        this.caller.setState(dic)
        this.onFinishSuccess(data, response);
      }
      else if (response) {
        if(response.status == 401) {
          this._dealUnauthorized(this.caller);
        }
        else {
          this.caller.setState({viewStatus: response.status})
        }
      }
      else {
        this.caller.setState({viewStatus: 400})
      }
    }
}
